//
//  MVSecendListView.m
//  testCocoPods1.0
//
//  Created by ChenJs92 on 16/11/15.
//  Copyright © 2016年 chenjs92. All rights reserved.
//

#import "MVSecendListView.h"
#import "MVSecendScrooViewMode.h"
@interface MVSecendListView()
@property (strong, nonatomic) MVSecendScrooViewMode *viewModel;
@property (strong, nonatomic) UIView *mainView;
@property (strong, nonatomic) UIScrollView *bbView;

@end

@implementation MVSecendListView
-(instancetype)initWithViewModel:(id<MVViewModelProtocol>)viewModel{
    self.viewModel = (MVSecendScrooViewMode *)viewModel;
    return [super initWithViewModel:viewModel];
}
-(void)updateConstraints{
    WS(weakSelf)
    [self.mainView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.edges.mas_equalTo(weakSelf);
    }];
//    [self.bbView mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.top.left.right.mas_equalTo(0);
//        make.height.mas_equalTo(50);
//    }];
    [super updateConstraints];
}
#pragma mark - private
- (void)yd_setupViews {
    
    [self addSubview:self.mainView];
//    [self addSubview:self.bbView];
    [self setNeedsUpdateConstraints];
    [self updateConstraintsIfNeeded];
}
-(void)yd_bindViewModel{
    
    [self setActiList];
}
-(void)setActiList{
    NSLog(@"绘制listView----------");
//    NSArray *actiList = self.viewModel.actiList;
//    CGFloat btnWidth = self.bounds.size.width/4.;
//    for (int i=0; i<actiList.count; i++) {
//        MVSecendScrooViewDataModel *model = (MVSecendScrooViewDataModel *)actiList[i];
//        UIButton *btn = [[UIButton alloc] initWithFrame:CGRectMake(i%4*btnWidth, i/4*40, btnWidth, 40)];
//        [btn setTitleColor:[UIColor purpleColor] forState:UIControlStateNormal];
//        [btn setTitle:model.titleName forState:UIControlStateNormal];
//        [self addSubview:btn];
//    }
}
-(MVSecendScrooViewMode *)viewModel{
    if (!_viewModel) {
        _viewModel = [[MVSecendScrooViewMode alloc] init];
    }
    return _viewModel;
}
-(UIView *)mainView{
    if (!_mainView) {
        _mainView = [[UIView alloc] init];
        _mainView.backgroundColor = [UIColor colorWithRed:0.000 green:0.502 blue:0.251 alpha:1.000];
    }
    return _mainView;
}
-(UIScrollView *)bbView{
    if (!_bbView) {
        _bbView = [[UIScrollView alloc] init];
        _bbView.backgroundColor = [UIColor colorWithRed:0.800 green:0.400 blue:1.000 alpha:1.000];
    }
    return _bbView;
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
